<?php
require_once substr(dirname(__FILE__),0,-1).'sub/init.php';
if(@!in_array('party',$navarr))exit('该功能已关闭');
require_once ZEAI.'sub/conn.php';
$nodatatips = "<div class='nodatatips' style='margin:0 auto;padding-top:10rem'><i class='ico'>&#xe608;</i>暂时木有内容</div>";
/***********************主体入口***************************/
$_ZEAI['pagesize']= 5;
if(ifint($t))$SQL = " AND flag=$t";
$ZEAI_SELECT = "SELECT id,title,flag,jzbmtime,path_s,address FROM ".__TBL_PARTY__." WHERE flag>0 AND path_s<>'' ".$SQL.$agentSQL." ORDER BY px DESC,id DESC";
$ZEAI_total = $db->COUNT(__TBL_PARTY__," flag>0 AND path_s<>''".$SQL);$ZEAI_totalP = ceil($ZEAI_total/$_ZEAI['pagesize']);//,address
if ($submitok == 'ajax_list')exit(Zeai_ajax_list_fn($ZEAI_totalP,$p));
/*********************** BODY 开始***************************/
$headertitle = '相亲活动 - ';$nav='index';?>
<!doctype html><html><head><meta charset="utf-8">
<title><?php echo $headertitle;?><?php echo $_ZEAI['siteName'];?></title>
<?php echo HEADMETA; ?>
<meta name="generator" content="Zeai.cn V9" />
<link href="<?php echo RES;?>m/css/m.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo HOST;?>/cache/zeaicolor.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo RES;?>m/css/party.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<script src="<?php echo RES;?>www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/m.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<?php
if (is_weixin()){
	require_once ZEAI."api/weixin/jssdk.php";?>
	<script src="<?php echo RES;?>jweixin-1.2.0.js"></script>
	<script>
	wx.config({debug:false,
		appId: '<?php echo $signPackage["appId"];?>',
		timestamp: <?php echo $signPackage["timestamp"];?>,
		nonceStr: '<?php echo $signPackage["nonceStr"];?>',
		signature: '<?php echo $signPackage["signature"];?>',
		jsApiList: ['hideMenuItems','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo']
	});
	var share_title = '相亲活动 - <?php echo dataIO($_ZEAI['siteName'],'out'); ?>',
	share_desc  = '线下实名交友活动_相亲大会！',
	share_link  = '<?php echo mHref('party'); ?>',
	share_imgUrl= '<?php echo UP.$_ZEAI['logo']; ?>';
	wx.ready(function () {
		wx.onMenuShareAppMessage({title:share_title,desc:share_desc,link:share_link,imgUrl:share_imgUrl});
		wx.onMenuShareTimeline({title:share_title,link:share_link,imgUrl:share_imgUrl});
	});
	</script>
<?php }?>
<style>
.party_list a dl dt{background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.8)}
.party_list a .djs .timestyle{background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.7)}
/*topnav*/
.topnav1{background-image:url("<?php echo RES;?>m/img/my_bg.png");background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.topnav a.ed:after{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.topnav1 a.ed:after{background-color:#fff}
<?php if($_ZEAI['m_mb']==2)echo '.TRnav_btn i{color:'.$_ZEAI['mob_mbcolor'].'}';?>
</style>
</head><body>
<?php if ($_ZEAI['m_mb']==2){$nav='party';$TRnav_btn = 'hide';$mainstyle=' style="margin-top:0"';require_once ZEAI.'m/top2.php';?>
	<div class="tab2">
        <a href="party.php"><i class="_new ico">&#xe695;</i><span>最新</span></a>
        <a href="party.php?t=1"><i class="_flag1 ico">&#xe65a;</i><span>报名中</span></a>
        <a href="party.php?t=2"><i class="_flag2 ico">&#xe643;</i><span>进行中</span></a>
        <a href="party.php?t=3"><i class="_flag3 ico">&#xe60f;</i><span>已结束</span></a>
    </div>
<?php }else{?>
    <div class="topnav<?php echo ($_ZEAI['m_mb']==1)?' topnav1':'';?>">
        <a href="party.php"<?php echo (empty($t))?' class="ed"':'';?>>活动</a>
        <a href="party.php?t=1"<?php echo ($t == 1)?' class="ed"':'';?>>报名中</a>
        <a href="party.php?t=2"<?php echo ($t == 2)?' class="ed"':'';?>>进行中</a>
        <a href="party.php?t=3"<?php echo ($t == 3)?' class="ed"':'';?>>已结束</a>
    </div>
<?php }?>
<div class="party_list" id="ZEAI_list"<?php echo $mainstyle;?>><?php if($ZEAI_totalP>0){echo Zeai_ajax_list_fn($ZEAI_totalP,$p);}else{echo $nodatatips;}?></div>
<?php if ($ZEAI_total > $_ZEAI['pagesize']){?>
<script>
var ZEAI_totalP = parseInt(<?php echo $ZEAI_totalP; ?>),p=2;
var postjson = {submitok:'ajax_list',ZEAI_totalP:ZEAI_totalP};
zeaiOnscroll_json={url:MHOST+'/party'+zeai.extname,data:postjson};
document.body.onscroll = zeaiOnscroll;
</script>
<div id="backtop"><a href="#top" id="btmTopBtn"><i class="ico7">&#xe60a;</i>顶部</a></div>
<?php }
if (!empty($_GZH['wx_gzh_ewm']) && ifint($cook_uid)){wx_endurl('您刚刚浏览的页面【相亲活动】',mHref('party'));}
require_once ZEAI.'m/TRnav.php';
if($_ZEAI['m_mb']==2){
	require_once ZEAI.'m/bottom2.php';
}else{
	require_once ZEAI.'m/bottom.php';
}
function rows_ulist($rows) {
	global $_ZEAI,$db;
	$fid   = $rows['id'];
	$bmnum    = $rows['bmnum'];
	$path_s   = $rows['path_s'];
	$jzbmtime = $rows['jzbmtime'];
	$flag     = $rows['flag'];
	//$hdtime  = $rows['hdtime'];
	$address = dataIO($rows['address'],'out');
	$title = dataIO($rows['title'],'out');
	//$num_n = $rows['num_n'];
	//$num_r = $rows['num_r'];
	//$click = $rows['click'];
	$path_b=smb($path_s,'b');
	$path_b_url=UP.$path_b;
	$dted=($flag==3)?' class="ed"':'';
	$echo  = '<a href=\''.mHref('party',$fid).'\' clsid="'.$fid.'">';
	$echo .= '<h3>'.$title.$hot.'</h3>';
	$echo .= '<div class="pic"><img src="'.$path_b_url.'"></div>';
	$echo .= '<div class="djs">'.party_djs($flag,$jzbmtime).'</div>';
	$bmlist = party_getBmUlist($fid);
	$bmlist = (empty($bmlist))?'<div class="FL">'.$address.'</div>':$bmlist;
	$echo .= '<dl><dd>'.$bmlist.'<div class="partyflag">'.partyflag($flag).'</div></dd></dl>';
	$echo .= '</a>';
	return $echo;
}
function party_getBmUlist($fid) {
	global $db,$_ZEAI;
	$rt=$db->query("SELECT U.sex,U.photo_s,U.photo_f,U.photo_ifshow,U.flag,a.photo_ifshow AS Pphoto_ifshow FROM ".__TBL_PARTY_USER__." a,".__TBL_USER__." U WHERE a.uid=U.id AND U.flag=1 AND a.fid=$fid ORDER BY a.id DESC LIMIT 5");
	$echo = '';
	WHILE ($rows = $db->fetch_array($rt,'num')){
		$sex      = $rows[0];
		$photo_s  = $rows[1];
		$photo_f  = $rows[2];
		$photo_ifshow = $rows[3];
		$uflag    = $rows[4];
		$Pphoto_ifshow = $rows[5];
		$hidden = ($Pphoto_ifshow==0)?1:0;
		$photo_s_url=photo_s_out('{"hidden":"'.$hidden.'","smb":"s","sex":"'.$sex.'","photo_s":"'.$photo_s.'","photo_f":"'.$photo_f.'","photo_ifshow":"'.$photo_ifshow.'","uflag":"'.$uflag.'","outkind":"url"}');
		$echo.='<img src="'.$photo_s_url.'">';
	}
	return $echo;
}
function party_djs($flag,$jzbmtime) {
	$d1  = ADDTIME;
	$d2  = $jzbmtime;
	$totals  = ($d2-$d1);
	$day     = intval( $totals/86400 );
	$hour    = intval(($totals % 86400)/3600);
	$hourmod = ($totals % 86400)/3600 - $hour;
	$minute  = intval($hourmod*60);
	if ($flag >= 2)$totals = -1;
	if (($totals) > 0) {
		$tmp='<span class="jzbmT"><i class="ico">&#xe634;</i> 截止报名还剩</span>';
		if ($day > 0){
			$outtime = $tmp."<span class=timestyle>$day</span>天";
		} else {
			$outtime = $tmp;
		}
		$outtime .= "<span class=timestyle>$hour</span>小时<span class=timestyle>$minute</span>分钟";
	} else {
		$outtime = '报名已经结束';
	}
	$outtime = '<font>'.$outtime.'</font>';
	return $outtime;
}
function partyflag($flag) {
	switch ($flag){ 
		case 0:$flag_str = "<span class='partyflag0'>未审核</span>";break;
		case 1:$flag_str = "<span class='partyflag1'>报名中</span>";break;
		case 2:$flag_str = "<span class='partyflag2'>进行中</span>";break;
		case 3:$flag_str = "<span class='partyflag3'>圆满结束</span>";break;
	}
	return $flag_str;
}?>